#include<bits/stdc++.h>

using namespace std;

int main() {
    char s[33];
    while (cin >> s) {
        int tot = 0;
        for (int i = 0; i < 32; i++) {

            tot |= (s[i] - '0') << (31 - i);
        }
        cout << tot << endl;
    }

    return 0;
}
